$(function() {


     $(document).on("click","#subSearch",function(e){
      var loading = layer.msg('加载中...', {icon: 16});
      var search = $("#inquery_list_form");
      $.get(search[0].action,search.serialize(),
        function(data){
          
        }).error(function(data) {
            alert("请求失败！")
        }).success(function(data) {
          window.location.href=search[0].action;
          layer.close(loading);
        });
      stopDefault(e);
    })

      $(document).on("click",".searchLawyerList dl",function(e){
        window.location.href=url+'/case/'+250;
         stopDefault(e);
    })

          

    //初始化
   /* init();
   function init(){
        var loading = layer.msg('加载中...', {icon: 16}); 
        $("#page").empty(); //删除tbody中已经存在的数据

        $.get(url+'?rows_per_page=80', function(data){
            
        }, "json").error(function(data) {
            alert('服务器暂时无法响应，请稍后再试');
        }).success(function(data) {
            var str  =  ""; 
            var obj = data.data;
                for(var i=0; i<obj.length; i++)  
                {  
                  obj[i].view_count == undefined ? obj[i].view_count =0 : obj[i].view_count;
                  obj[i].likes_count == undefined ? obj[i].likes_count =0 : obj[i].likes_count;
                  obj[i].comments_count == undefined ? obj[i].comments_count =0 : obj[i].comments_count;

                   //返回数据位json格式，遍历json，拼凑成table中的行
                    str +='<dl class="issueClassInfo clear">'
                      str +='<dt><b>问题分类</b></dt>'
                      str +='<dd><b><a href="'+jumpUrl+'/question/'+obj[i].id+'">'+obj[i].title+'</a></b></dd>'
                      str +='<dt>&nbsp;</dt>'
                      str +='<dd class="issuetxt"><a href="'+jumpUrl+'/question/'+obj[i].id+'">'+obj[i].content+'</a></dd>'
                      str +='<dt>&nbsp;</dt>'
                      str +='<dd>'
                          str +='<label class="dateTime">'+obj[i].post_extra.created_at+'</label>'
                          str +=' <div class="numlr">'
                            str +='<a href="javascript:void(0);" title="阅读"><label class="readNumber">'+obj[i].post_extra.views_count+'</label></a><b class="line">|</b>'
                            str +='<a href="javascript:void(0);" title="点赞"><label class="like">'+obj[i].post_extra.likes_count+'</label></a><b class="line">|</b>'
                            str +='<a href="javascript:void(0);" title="评论"><label class="review last">'+obj[i].post_extra.comments_count+'</label></a>'
                          str +='</div>'
                      str +='</dd>'
                    str +='</dl>';
                }  
                //追加如tbody中 
                $("#page").append(str);
       
              //数据加载完成之后,隐藏加载中这个图标  
              layer.close(loading);    

          });
    }   
*/

     

    /* 公用js */
    $(".btn-more").toggle(
        function () {
          $(this).parent().parent().find(".more").addClass("unfolded")
        },
        function () {
          $(this).parent().parent().find(".more").removeClass("unfolded");
        }
    );

    $("ul.area-wrap li a ").click( function (e) { 
      var $this = $(this);
      var morelen = $this.parent().parent().find(".more").length;
      var more = $this.parent().parent().find(".more").children("li").children("a")
      var hasMore = $this.parent().parent().parent().children("li").children("a");
      if(morelen>0){
        more.removeClass("active");
        $this.addClass("active").siblings().removeClass("active");
      }else{
        hasMore.removeClass("active");
        $this.addClass("active").siblings().removeClass("active");
      }
      //$this.addClass("active").children("a").end().siblings().removeClass("active").children("a");
      stopDefault(e);
    });
    
 });